<?php
include("../inc/global.inc");
include("../steps.php");
$url="cqjob.php";
$thepage=$_GET['page']?$_GET['page']:1;
$maxpage=10;
if($_POST[act]){
  if($_POST[del]){
             $del_num=count($_POST[del]); 
             for($i=0;$i<$del_num;$i++){ 
                 @mysql_query("update job_mailbox set from_del='0' where id='".$_POST[del][$i]."'"); 
                }  
     }else{
	   echo("<script>alert('请选择删除项');location='javascript:history.go(-1)';</script>"); 
	 }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>发件夹-三帝招聘网</title>
<link href="../css/body.css" rel="stylesheet" type="text/css"/>
<link href="css/head.css" rel="stylesheet" type="text/css"/>
<link href="css/search_list.css" rel="stylesheet" type="text/css"/>
<link href="../css/foot.css" rel="stylesheet" type="text/css"/>
<script>
function checkall(form,prefix,checkall) {
for(var i=0;i < form.elements.length; i++) {
var e = form.elements[i];
if(e.name != checkall && (!prefix || (prefix && e.name.match(prefix)))) {
e.checked = form.elements[checkall].checked;
}
}
}</script></head>
<body>
<?php include("../inc/top.php");?>
<div class="menuBox1">
<a href="/member/">管理中心</a>
<a href="/member/show.php">我的简历</a>
<a href="/member/search_manage.php">我的搜索器</a>
<a href="/member/favorites.php">收藏夹</a>
<a href="/member/cqjob.php" class="hover">发件夹</a>
<a href="/member/inbox.php">收件夹</a>
<div class="onl"></div>
</div>
<div id="mian">
  <div id="box">
  <div class="JobBox sideyellow backyellow">
<div class="mian_Co">
  <div class="title size14 topside6"><strong>发件夹</strong></div>
  <table width="99%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="table">
  	<form id="form1" name="form1" method="post" action="">
	<input type="hidden" name="act" value="job.sandib2b.cn" />
	    <tr>
		    <td style="padding-left:40px;"><input type="checkbox" name="chkall" onclick="checkall(this.form, 'del', 'chkall')">全选&nbsp;&nbsp;<input type="submit" value="删 除" class="in" /></td></tr>
		<tr>
    <tbody>
		<tr>
		  <td width="100%" height="46"><table width="100%" border="0" cellpadding="0" cellspacing="0" id="main_body" style="border:1px #ccc solid">
              <tr>
                <td width="47" height="29" bgcolor="#FFF5EC">&nbsp;</td>
                <td width="228" align="center" bgcolor="#FFF5EC"><strong>&nbsp;主题</strong></td>
                <td width="95" align="center" bgcolor="#FFF5EC"><strong>发送时间</strong></td>
                <td width="118" align="center" bgcolor="#FFF5EC"><strong>已申请人数</strong></td>
                <td width="283" align="center" bgcolor="#FFF5EC"><strong>公司名称</strong></td>
                <td width="170" align="center" bgcolor="#FFF5EC"><strong>应聘职位</strong></td>
				<td width="42" align="center" bgcolor="#FFF5EC"><strong>阅读</strong></td>
                </tr>
		<?php
		   $rs=@mysql_query("select job_mailbox.id,job_mailbox.box_title,job_mailbox.job_id,job_mailbox.is_read,job_mailbox.box_addtime,member.m_cname,member.m_user from job_mailbox inner join member on (job_mailbox.to_id=member.id) where job_mailbox.from_id='$_COOKIE[job_user_id]' and  job_mailbox.from_del=1 order by job_mailbox.id desc limit ".($thepage-1)*$maxpage.",$maxpage");
		   $i=1;
		   while($row=@mysql_fetch_array($rs)){

			$num=@mysql_result(@mysql_query("select count(id) from job_mailbox where job_id='$row[job_id]' and job_id>0"),0);
			$color=($i%2)?"#EBEBEB":"#F6F6F6";
		?>
              <tr bgcolor=<?=$color?>>
                <td height="30" align="center"><input type="checkbox" name="del[]" value="<?=$row['id']?>" /></td>
                <td height="30" align="center"><a href="outboxinfo.php?id=<?=$row['id']?>" target="_blank" style="color:#0000FF;"><?=$row[box_title]?></a></td>
                <td height="30" align="center"><?=date("Y-m-d",strtotime($row[box_addtime]))?></td>
                <td height="30" align="center"><?php if($num){echo $num;}?></td>
                <td align="center"><span class="did"><a href="/jobcom/<?=$row['m_user']?>/" target="_blank"><?=$row['m_cname']?></a></span></td>
                <td align="center">
			<?php if($row[job_id]){
			$rs2=@mysql_query("select * from job_post where id='$row[job_id]'");
			$row2=@mysql_fetch_array($rs2);
			?><a href="/jobpost/<?=$row2['id']?>.cfm" target="_blank"><?=$row2[job_title]?></a><?php }else{echo "给企业的意见或建议";}?></td>
                <td align="center"><?php if($row[is_read]==1){echo "是";}else{echo "<font color='red'>否</font>";}?></td>
              </tr>
   <?php $i++;}
	$totalrecord=@mysql_result(@mysql_query("select count(id) from job_mailbox where from_id='$_COOKIE[job_user_id]' and to_del=1"),0);
    $totalpage=ceil($totalrecord/$maxpage);
	?>
            </table></td>
		  </tr>
		  </form>
   <?php if($totalpage>0){?>
		<tr>
		  <td height="46" align="center"><table width="99%" height="40" border="0" cellpadding="0" cellspacing="0" id="main_body">
            <form name="pageform" method="get" action="" onSubmit="return onCheckPage()"><tr>
              <td align="right"><script language="javascript">
<!--
function showPageLink(sUrl,iPage,iCount){
	var i;
	i=Math.max(1,iPage-1);
	document.write("<a href=\"" + sUrl + "1\">第一页</a> ");
	document.write("<a href=\"" + sUrl + i + "\">上一页</a> ");
	for(i=Math.max(1,iPage-8);i<iPage;i++){
		document.write("<a href=\""+sUrl + i + "\"><b>" + i + "</b></a> ");
	}
	document.write("<font color='#ff3333'><b>" + iPage + "</b></font> ");
	for(i=iPage+1;i<=Math.min(iCount,iPage+8);i++){
		document.write("<a href=\""+sUrl + i + "\"><b>" + i + "</b></a> ");
	}
	i=Math.min(iCount,iPage+1);
	if(iCount>iPage+8) document.write("<span style='font-size:8px'>···</span> ");
	document.write("<a href=\"" + sUrl + i + "\">下一页</a> ");
	document.write("<a href=\"" + sUrl + iCount + "\">最后一页</a> ");
}
showPageLink("<?=$url?>?page=",<?=$thepage?>,<?=$totalpage?>);
//-->
              </script>&nbsp;&nbsp;&nbsp;共<?=$totalpage?>页　到<input type="text" name="page"  size="3" maxlength="5">页<input type="submit" value="确定" class="but"></td>
              </tr></form>
          </table></td>
		  </tr><?php }?>
    </tbody>
  </table>
</div>
</div>
<div class="onl"></div>
<div class="onl"></div>
</div>
<div class="onl"></div>
<?php include("../inc/foot.php");?>
</body>
</html>
<script language="javascript"> 
function onCheckPage(){
var page = parseInt(document.pageform.page.value); 
if(isNaN(page)){
alert("请输入数字(1,<?=$totalpage?>)");
return false; 
}
if(page ><?=$totalpage?>){
alert("请输入数字(1,<?=$totalpage?>)");
return false;
}
}
</script>